<template>
    <div class="M-tab">
        <span :class="{'act': act==index}" v-for="(item,index) in data" :key="index" @click="onTab(item, index)">
            {{item.text}}
        </span>
    </div>
</template>

<script>
export default {
    props: {
        cur: {
            type: Number,
            default: 0
        }
    },
    methods: {
        onTab: function(item,index){
            if(this.cur==index) return;
            this.cus = index;
            //点击后触发的回调
            if(item.action) item.action(item);
        }
    }
}
</script>

<style scoped lang="less">

</style>